package com.cndongtai.dao.impl;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.cndongtai.dao.BaseDao;
import com.cndongtai.dao.inter.TorchnUserInfoMapper;
import com.cndongtai.po.TorchnUserInfo;

@Repository("torchnUserInfoDao")
public class TorchnUserInfoDao extends BaseDao implements TorchnUserInfoMapper {

	@Override
	public int addTorchnUserInfo(TorchnUserInfo userInfo) {
		SqlSession sqlSession = getSqlSession();
		try {
			TorchnUserInfoMapper operation = sqlSession.getMapper(TorchnUserInfoMapper.class);
			return operation.addTorchnUserInfo(userInfo);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return 0;
	}

	@Override
	public TorchnUserInfo queryTorchnUserInfo(String openid) {
		SqlSession sqlSession = getSqlSession();
		try {
			TorchnUserInfoMapper operation = sqlSession.getMapper(TorchnUserInfoMapper.class);
			return operation.queryTorchnUserInfo(openid);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return null;
	}

}
